import { post } from '@/request/http'
import store from '@/store'

/**
 * 省市管理
 *  1. 省市列表查询 getPCList
 */

export const getPCList = (data) =>
  post(
    '/FTKJWLHYPT/base/tmProvinceModelList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            prvChnname:data.prvChnname,
          }
        },
        Orderbys: {},
        PageIndex: {
          FTKJWLHYPT: data.PageIndexs
        },
        PageSize: {
          FTKJWLHYPT: data.PageSizes
        }
      }
    }
  )
/**
 * 省市管理
 *  3. 新增省市 addPC
 */

export const addPC = ({
  prvCode,
  prvChnname,
  prvEgsname,
  prvShrcode,
  prvRemark,
  prvShrchn,
  // prvInsertuser,
  prvCtycd,
  prvIsValid,
  prvPreName
}) =>
  post(
    '/FTKJWLHYPT/base/addTmProvinceModel',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            prvCode,
            prvChnname,
            prvEgsname,
            prvShrcode,
            prvRemark,
            prvShrchn,
            prvInsertuser:store.state.user.USR_CODE_DX_H,
            prvCtycd,
            prvIsValid,
            prvPreName
          }
        }
      }
    }
  )

/**
 * 省市管理
 *  4. 编辑省市 editPC
 */

export const editPC = ({
  prvCode,
  prvChnname,
  prvEgsname,
  prvRemark,
  prvShrcode,
  prvShrchn,
  prvCtycd,
  prvIsValid,
  prvPreName
  // prvLstupduser
}) =>
  post(
    '/FTKJWLHYPT/base/editTmProvinceModel',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            prvCode,
            prvChnname,
            prvEgsname,
            prvShrcode,
            prvRemark,
            prvShrchn,
            prvLstupduser:store.state.user.USR_CODE_DX_H,
            prvCtycd,
            prvIsValid,
            prvPreName
          }
        }
      }
    }
  )
/**
 * 省市管理
 *  5. 删除省市 delPC
 */

export const delPC = data =>
  post(
    '/FTKJWLHYPT/base/delProvince',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            prvCode: data.prvCode,

          }
        }
      }
    }
  )

  export const provinceCityGj = data =>
  post(
    '/FTKJWLHYPT/base/GetCouModelList',
    {
      Data: {
        Parameters: {
          FTKJWLHYPT: {
            ctyCd: data.ctyCd,
            ctyCname:data.ctyCname,
            ctyEname:data.ctyCname,
          }
        }
      }
    }
  )


  //查询规格
export const getNormList=({
  normName,//规格名称
  normCode,//规格代码
  PageIndexs,
  PageSizes
})=>{
  return post('/FTKJWLHYPT/base/getNormList',{

    Data: {
      Parameters: {
        FTKJWLHYPT: {
          normName,
          normCode,
          fltUuid:store.state.user.FLT_UUID_DX_H,
          depId:store.state.user.DPTID_DX_H,
        }
      },
      PageIndex: {
        FTKJWLHYPT: PageIndexs
      },
      PageSize: {
        FTKJWLHYPT: PageSizes
      }

    }

  })
}

//新增规格
export const addNorm=({
  normName,
  normCode,
  isvalid,
  isdefault,
  remark
})=>{
  return post ('/FTKJWLHYPT/base/addNorm',{

    Data: {
      Parameters: {
        FTKJWLHYPT: {
          normName,
          normCode,
          isvalid,
          isdefault,
          fltUuid: store.state.user.FLT_UUID_DX_H,
          depId:store.state.user.DPTID_DX_H,
          creator:store.state.user.USR_CODE_DX_H,
          remark
        }
      }
    }
  })
}

//编辑规格
export const editNorm=({
  id,
  normName,
  normCode,
  remark,
  isvalid,
  isdefault
})=>{
  return post('/FTKJWLHYPT/base/editNorm',{
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          id,
          normName,
          normCode,
          lastModifier:store.state.user.USR_CODE_DX_H,
          fltUuid: store.state.user.FLT_UUID_DX_H,
          depId:store.state.user.DPTID_DX_H,
          remark,
          isvalid,
          isdefault
        }
      }
    }
  })
}

//删除规格
export const delNorm=({id})=>{
  return post('/FTKJWLHYPT/base/delNorm',{
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          id
        }
      }
    }
  })
}

//获取规格代码
export const getCode=()=>{
  return post('/FTKJWLHYPT/base/getCurrencyCode',{
    Data: {
      Parameters: {
        FTKJWLHYPT: {
          
        }
      }
    }
  })
}


